// This file is managed by Git and reads data from public/demos.json
// Last updated: 2025-08-21

// 从public/demos.json获取演示数据
let demos = {};

// 异步加载demos.json数据
async function loadDemosData() {
  try {
    const response = await fetch('/demos.json');
    const demosJson = await response.json();
    const demosList = demosJson.demos || [];
    
    // 构建demos对象
    demosList.forEach(demo => {
      demos[demo.id] = () => import(`../src/demos/${demo.component.split('/').pop()}`);
    });
  } catch (error) {
    console.error('Failed to load demos.json:', error);
    demos = {};
  }
}

// 初始化加载数据
loadDemosData();

export default demos;